<template>
<slot :controller="controller" :store="store" :model="model">
    <AppBasisViewLayout :class="classNames" :openType="openType">
        <template #default>
            <slot name="IBIZHardwareIndexPickupViewpickupviewpanelPickupViewPanel" :controller="controller" :store="store" :model="model" :actions="{ handleCtrlInit, handleCtrlAction, handleCtrlDestroy }">
                <IBIZHardwareIndexPickupViewpickupviewpanelPickupViewPanel
                    :singleSelect='true'
                    :openView="store.openView"
                    :newView="store.newView"
                    name="pickupviewpanel"
                    v-bind="model.ctrlParams.IBIZHardwarepickupviewpanel"
                    :context="store.context"
                    :viewParams="store.viewParams"
                    :closeView="store.closeView"
                    :pLoadingHelper="store.loadingHelper"
                    :pViewCtx="store.viewCtx"
                    @ctrl-init="(name:string, ability:any) => { handleCtrlInit(controller, name, ability) }"
                    @ctrl-action="(name:string, action:any, data:any) => { handleCtrlAction(controller, name, action, data) }"
                    @ctrl-destroy="(name:string, data:any) => { handleCtrlDestroy(controller, name, data) }"    />
            </slot>
        </template>
        <template #viewFooter>
            <slot name="ViewFooter" :controller="controller" :store="store" :model="model" :actions="{ handlePickupViewButtonAction }">
            <div class="view-footer__buttons">
            <AppButton type="primary" :disabled="store.selections.length === 0" @click="handlePickupViewButtonAction(controller, 'confirm')">确认</AppButton>
            <AppButton @click="handlePickupViewButtonAction(controller, 'cancel')">取消</AppButton>
            </div>
            </slot>
        </template>
    </AppBasisViewLayout>
</slot>
</template>
<script setup lang="ts">
// 基于template/src/views/{{appModules}}/{{pages@DEPICKUPVIEW}}/{{spinalCase page.codeName}}-base.vue.hbs生成
import { AppBasisViewLayout } from "@components/layout/basis-view-layout";
import IBIZHardwareIndexPickupViewpickupviewpanelPickupViewPanel from '@widgets/ibiz-hardware/index-pickup-viewpickupviewpanel-pickup-view-panel/index-pickup-viewpickupviewpanel-pickup-view-panel.vue';
import { useProps, useBasic, useAction, useController } from './ibiz-hardware-index-pickup-view-hook';
import { IEvent, PickupViewActionType, IPickupViewAbility, IPickupViewStore, IParam } from '@/core';

// 输入参数
const props = defineProps(useProps());

// 基础数据
const { 
    model,
    getClassNames, 
    useNavParamsBind,
	useEventBind,
    handleQuickSearch,
  	handleToolbarItemClick,
    handleComponentAction,
	handleCtrlAction,
	handleCtrlInit,
	handleCtrlDestroy,
    handlePickupViewButtonAction
} = useBasic(props);

const emit = defineEmits<{
    (event: 'view-action', name: string, action: PickupViewActionType, data: IParam[]): void;
    (event: 'view-init', name: string, data: IPickupViewAbility): void;
    (event: 'view-mounted', name: string, data: IParam): void;
    (event: 'view-destroy', name: string, data: IParam): void;
}>();

const evt = useEventBind(emit);
const classNames = computed(() => {
  	return getClassNames(props);
});

// 初始化控制器
const controller = useController(props, evt);

useNavParamsBind(controller, props);

const store: IPickupViewStore = controller.getStore();

onMounted(() => {
    controller.viewMounted();
})

onUnmounted(() => {
    controller.viewDestroy();
})

</script>
